import request from '@/utils/request'

/**
 * 分页获取发帖信息
 * @param data
 * @returns {*}
 */
export function getPagePost(data) {
  return request({
    url: '/post',
    method: 'GET',
    params: data
  })
}

/**
 * 根据id获取发帖详情
 * @param id
 * @returns {*}
 */
export function getPostById(id) {
  return request({
    url: `/post/${id}`,
    method: 'GET',
  })
}

/**
 * 审核发帖
 * @param data
 * @returns {*}
 */
export function auditPost(data) {
  return request({
    url: `/post/audit`,
    method: 'POST',
    data: data
  })
}

export function topPost(data) {
  return request({
    url: `/post`,
    method: 'put',
    data: data
  })
}

/**
 * 获取敏感词
 * @param data
 * @returns {*}
 */
export function getBanwords(data) {
  return request({
    url: `/post/banword`,
    method: 'GET',
    params: data
  })
}

export function addorupdateBanword(data) {
  return request({
    url: `/post/banword`,
    method: 'post',
    data: data
  })
}

export function deleteBanword(data) {
  return request({
    url: `/post/banword/${data}`,
    method: 'delete'
  })
}

/**
 * 获取回帖评论
 * @param data
 * @returns {*}
 */
export function getComments(data) {
  return request({
    url: `/comment`,
    method: 'GET',
    params: data
  })
}

export function deleteComment(data) {
  return request({
    url: `/comment/${data}`,
    method: 'delete'
  })
}

export function addPost(data) {
  return request({
    url: `/post`,
    method: 'post',
    data: data
  })
}

export function deletePost(data) {
  return request({
    url: `/post/${data}`,
    method: 'delete'
  })
}
